#include <iostream>
#include <thread>
#include <string>
#include <future>
#include <memory>
int add(int x,int y)
{
    std::cout<<"add"<<std::endl;
    return x + y;
}
int main()
{
    auto task = std::make_shared<std::packaged_task<int(int,int)>>(add);

    auto f = task->get_future();
    std::thread tid([task]()
    {
        (*task.get())(10,20);
    });
    tid.join();
    return 0;
}